/**
 * 
 */
package info.niwota.profile;

import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * @author qiangli
 *
 */
public class MyProfileActivity extends BaseProfileActivity {

	private static final String TAG = "MyProfileActivity";

	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	
		requestWindowFeature(Window.FEATURE_LEFT_ICON);
		
		setContentView(R.layout.profile_view);

		peer = null;

		setTitle(R.string.app_name);
		getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
				R.drawable.icon);
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
		
		//hide id, show tagline
		findViewById(R.id.profile_id_label).setVisibility(View.INVISIBLE);
		TextView tv = (TextView) findViewById(R.id.profile_id);
		tv.setText(R.string.app_tagline);
		
		ImageView btn = (ImageView) findViewById(R.id.profile_btn_fav);
		btn.setVisibility(View.GONE);
	}
	
	@Override
	protected void onResume() {
		super.onResume();
		if (Debug.DEBUG) {
			Log.d(TAG, "onResume");
		}
		
		loadLocation();
	}
	
	@Override
	protected void onPause() {
		super.onPause();
		if (Debug.DEBUG) {
			Log.d(TAG, "onPause");
		}
		
		cancelLoadLocation();
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (Debug.DEBUG) {
			Log.d(TAG, "onKeyDown " + keyCode);
		}
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			return true;
		}
		return super.onKeyDown(keyCode, event);
	}
}
